package com.bcxj.servicemap.service;

import com.bcxj.internalcommon.dto.ResponseResult;
import com.bcxj.internalcommon.response.TerminalResponse;
import com.bcxj.internalcommon.response.TrsearchResponse;
import com.bcxj.servicemap.remote.TerminalClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/**
 * ClassName: TerminalService
 * Package: com.bcxj.servicemap.service
 * Description:
 *
 * @Author BCXJ
 * @Create 2024/10/31 22:43
 * @Version 1.0
 * @Since 1.0
 */
@Service
public class TerminalService {

    @Autowired
    private TerminalClient terminalClient;

    /**
     * 添加终端
     * @return
     */
    public ResponseResult add(String carName, String desc) {
        return terminalClient.addTerminal(carName, desc);
    }


    /**
     * 搜索终端
     * @param center
     * @param radius
     * @return
     */
    public ResponseResult<List<TerminalResponse>> arroundSearch(String center, String radius) {
        return terminalClient.arroundSearch(center, radius);
    }


    /**
     * 终端的轨迹的统计
     * @param tid
     * @param startTime
     * @param endTime
     * @return
     */
    @PostMapping("/trsearch")
    public ResponseResult<TrsearchResponse> trsearch(String tid, Long startTime, Long endTime) {
        return terminalClient.trsearch(tid, startTime, endTime);
    }
}
